def containsDuplicate(nums):
    hash_map = set()
    for i in nums:
        if i in hash_map:
            return True
        else:
            hash_map.add(i)
    else:
        return False


print(containsDuplicate([1, 2, 3, 1]))